#include <iostream>
#include <cstdio>
#include <vector>

using std::vector;
using std::cin;
using std::cout;
using std::min;

const int MOD = 268435459;

void input(vector <vector <int> > &open, vector <vector <int> > &dp) {
    int n, m;
    cin >> n >> m;
    open.resize(n);
    dp.resize(n);
    for (int i = 0; i < n; i++) {
        dp[i].resize(m);
        open[i].resize(m);
        for (int j = 0; j < m; j++) {
            cin >> open[i][j];
        }
    }
}

void solution(const vector <vector <int> > &open, vector <vector <int> > &dp) {
    dp[0][0] = open[0][0];
    for (int i = 1; i < open.size(); i++) {
        dp[i][0] = dp[i - 1][0] * open[i][0];
    }
    for (int i = 1; i < open[0].size(); i++) {
        dp[0][i] = dp[0][i - 1] * open[0][i];
    }
    for (int i = 1; i < open.size(); i++) {
        for (int j = 1; j < open[i].size(); j++) {
            dp[i][j] = (dp[i - 1][j] + dp[i][j - 1]) * open[i][j] % MOD;
        }
    }
}

void output(const vector <vector <int> > &dp) {
    cout << dp.back().back();
}

int main() {
    vector <vector <int> > open, dp;
    input(open, dp);
    solution(open, dp);
    output(dp);
    return 0;
}

